/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/. */

@import "variables.less";

.tabs {
  background: @tabsBackground;
  box-sizing: border-box;
  display: flex;
  flex: 1;
  padding: 0 4px 0 6px;
  height: 26px;
  position: relative;
  white-space: nowrap;
  z-index: 310;
}

.tabContainer {
  display: flex;
  flex: 1;
  z-index: 2;

  .browserButton {
    height: 26px;
    line-height: 26px;
  }
}

.tab {
  border-radius: @borderRadius @borderRadius 0px 0px;
  border-width: 1px 1px 0;
  box-sizing: border-box;
  color: #3B3B3B;
  display: flex;
  height: 26px;
  margin: 0;
  transition: transform 200ms ease;
  left: 0;
  opacity: 1.0;
  padding: 0;
  width: 100%;
  -moz-window-dragging: no-drag;
  align-items: center;
  justify-content: center;

  &:not(.isPinned) {
    background: @chromeTertiary;
  }

  .tabTitle {
    -webkit-user-select: none;
    box-sizing: border-box;
    display: inline-block;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
    width: calc(~'100% - 40px');
    height: 16px;
  }
  .tabIcon {
    background-position: center;
    background-repeat: no-repeat;
    display: inline-block;
    font-size: 12px;
    margin-left: 4px;
    margin-right: 4px;
  }

  .privateIcon {
    background-position: center;
    background-repeat: no-repeat;
    display: inline-block;
    font-size: 14px;
    margin: auto 0px auto 9px;
    position: relative;
    vertical-align: middle;
  }


  .audioPlaybackActive {
    margin: auto 4px auto 0;
    color: @audioColor;
  }

  .thumbnail {
    display: none;
    position: absolute;
    top: 32px;
    left: 0;
    border: 1px solid #000;
    padding: 10px;
    background: #fff;
    pointer-events: none;
    z-index: 312;
  }

  &.active {
    background: @activeTabDefaultColor;
  }

  &.private {
    background: @privateTabBackground;
    color: #fff;
    &:not(.active) {
      background: lighten(@privateTabBackground, 40%);
    }
  }

  &:hover {
    .closeTab {
      opacity: 1;
    }

    .thumbnail {
      display: block;
    }
  }

  &:not(.active):hover {
    background: linear-gradient(to bottom, @chromeTertiary, @chromeSecondary);
    &.private {
      background: lighten(@privateTabBackground, 20%);
    }
  }

  &.dragging {
    &:hover {
      .closeTab {
        opacity: 0;
      }
    }
  }

  .closeTab {
    opacity: 0;
    text-align: center;
    width: 16px;
    height: 16px;
    margin-left: 4px;
    margin-right: 4px;

    &:hover {
      opacity: 1;
    }

    border: 0px solid white;
    border-radius: 50%;
    z-index: 3;
  }
}

.tabArea {
  box-sizing: border-box;
  display: inline-block;
  padding: 0 2px 0 0;
  position: relative;
  vertical-align: top;
  // There's a special case that tabs should span the full width
  // if there are a full set of them.
  &:not(.partOfFullPageSet) {
    max-width: 184px;
  }

  &:not(.isPinned) {
    flex: 1;
  }

  hr.dragIndicator {
    position: absolute;
    top: 0;
    left: -1px;
    z-index: 100;
    height: 100%;
    width: 1px;

    &.dragIndicatorEnd {
      bottom: -5px;
      top: 0;
      right: -3px;
      left: unset;
    }

    display: none;
    &.dragActive {
      display: block;
      color: @highlightBlue;
    }
  }
}

.tabsToolbar {
  background: @tabsBackground;
  display: flex;
  height: 26px;
  border-bottom: 1px solid @chromeTertiary;
}

.tabsToolbarButtons {
  background: @tabsBackground;
  padding-right: 5px;
  .browserButton {
    display: inline-block;
    line-height: initial;
  }
}

.tabPages {
  background: @tabsBackground;
  border-top: 1px solid @chromeTertiary;
  display: flex;
  height: 14px;
  justify-content: center;
  position: relative;
  text-align: center;
  z-index: 12;

  &.singlePage {
    height: 3px;
  }
}

.tabPage {
  align-items: center;
  background-color: @chromeTertiary;
  border-radius: @borderRadius;
  box-sizing: border-box;
  display: inline-block;
  margin: auto 2.5px;
  height: 6px;
  width: 34px;
  vertical-align: middle;

  &:hover {
    background-color: lighten(@chromeControlsBackground2, 10%);
  }

  &.audioPlaybackActive {
    border: 1px solid @audioColor;
  }

  &.active {
    background-color: @chromePrimary;
  }
}

.prevTab, .nextTab {
  display: none !important;
  color: #3B3B3B;
  font-size: 24px !important;
  height: 20px;
  line-height: 20px !important;
  vertical-align: top;
  width: 50px;

  &:not([disabled]) {
    display: inline-block !important;
    background: #eeeeee;
    &:hover {
      background: lighten(#eeeeee, 10%);
    }
  }
}

.prevTab {
  background: linear-gradient(to right, @chromeControlsBackground2, @tabsBackground);
  border-bottom-left-radius: @borderRadius;
  border-top-left-radius: @borderRadius;
  padding-left: 10px;
  text-align: left;
  transform: translateX(10px);
}

.nextTab {
  background: linear-gradient(to left, #afb0b4, #cccccc);
  border-bottom-right-radius: @borderRadius;
  border-top-right-radius: @borderRadius;
  float: right;
  padding-right: 10px;
  text-align: right;
  transform: translateX(-20px);
}

.pinnedTabs {
  margin-left: 9px;
}
